import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CollageAccountLogVO, CollageAccountLogForm, CollageAccountLogQuery } from '@/api/system/collageAccountLog/types';
import { CollageAccountDetailLogQuery } from '@/api/system/collageAccountDetailLog/types';
import { OrderVO } from '@/api/system/order/types';

/**
 * 查询拼团结算账单记录列表
 * @param query
 * @returns {*}
 */

export const listCollageAccountLog = (query?: CollageAccountLogQuery): AxiosPromise<CollageAccountLogVO[]> => {
  return request({
    url: '/system/collageAccountLog/queryCollageAccountLogList',
    method: 'get',
    params: query
  });
};

/**
 * 查询拼团结算账单记录详细
 * @param id
 */
export const getCollageAccountLog = (id: string | number): AxiosPromise<CollageAccountLogVO> => {
  return request({
    url: '/system/collageAccountLog/' + id,
    method: 'get'
  });
};

/**
 * 新增拼团结算账单记录
 * @param data
 */
export const addCollageAccountLog = (data: CollageAccountLogForm) => {
  return request({
    url: '/system/collageAccountLog',
    method: 'post',
    data: data
  });
};

/**
 * 修改拼团结算账单记录
 * @param data
 */
export const updateCollageAccountLog = (data: CollageAccountLogForm) => {
  return request({
    url: '/system/collageAccountLog',
    method: 'put',
    data: data
  });
};

/**
 * 删除拼团结算账单记录
 * @param id
 */
export const delCollageAccountLog = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/collageAccountLog/' + id,
    method: 'delete'
  });
};

/**
 * 查询结算详情
 */
export const queryCollageAccountLogDetailList = (query?: CollageAccountLogQuery): AxiosPromise<CollageAccountLogVO[]> => {
  return request({
    url: '/system/collageAccountLog/queryCollageAccountLogDetailList',
    method: 'get',
    params: query
  });
};

/**
 * 查询结算订单列表
 */
export const queryCollageAccountLogOrderList = (query?: CollageAccountDetailLogQuery): AxiosPromise<OrderVO[]> => {
  return request({
    url: '/system/collageAccountLog/queryCollageAccountLogOrderList',
    method: 'get',
    params: query
  });
};

/**
 * 查询拼团账单
 */
export const queryCollageAccount = (query?: any) => {
  return request({
    url: '/system/collageAccountLog/queryCollageAccount',
    method: 'get',
    params: query
  });
};
